package job5;
/*
设计一个多线程的程序如下：设计一个火车售票模拟程序。假如火车站要有100张火
车票要卖出，现在有5个售票点同时售票，用5个线程模拟这5个售票点的售票情况。
 */
public class Ticke implements Runnable {
    private int Num = 100;

    @Override
    public void run() {
        String name = Thread.currentThread().getName();
        while (true) {
            if (Num < 1) {
                break;
            }
            System.out.println(name + "售票第" + Num-- + "张");
        }
    }

    public static void main(String[] args) {
        Runnable t = new Ticke();
        Thread t1 = new Thread(t, "一号售票点");
        Thread t2 = new Thread(t, "二号售票点");
        Thread t3 = new Thread(t, "三号售票点");
        Thread t4 = new Thread(t, "四号售票点");
        Thread t5 = new Thread(t, "五号售票点");
        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
    }
}